Public Key Authentication uses a public and private key to authenticate a client. The client generates a signature using the private key. This signature is verified with the public key by signing a challenge sent by the server. It is important to note that a signature cannot be forged without the private key. Each signature is unique and cannot be reused. This policy of signature generation and non-reuse makes Public Key Authentication a more secure login system than the standard username/password login, which is easily defeated by a man-in-the-middle attack.
The method is called 'publickey' in the SSH-2 protocol specification, however it actually requires a private key to be provided by the client (the server will use the public key counterpart to verify the signature).
PowerTCP SSH and SFTP for .NET supports DSA and RSA private keys in OpenSSH, SSH2, and SSH.com formats (must contain a "-----BEGIN DSA PRIVATE KEY-----", "-----BEGIN RSA PRIVATE KEY-----" or "---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----" tag).
The private key string may be encrypted ("Proc-Type: 4,ENCRYPTED"). The library supports DES-CBC and DES-EDE3-CBC encryption, as well as the more exotic PEM encryptions AES-128-CBC, AES-192-CBC and AES-256-CBC.
NOTE PUTTY USERS: Even though your key file may start with "-----BEGIN..." it is not in the expected format. You must convert it to the OpenSSH key format with the "puttygen" tool (can be downloaded from the Putty website). Load your key and use the "Conversions/Export OpenSSH key" functionality to produce a compatible PEM file.
There is a free utility called PuTTYgen that can be used to generate key pairs. This utility can be downloaded from the PuTTY Download Page. Run PuTTYgen and follow these steps:
These instructions apply to a linux server, you will need to contact your IT department for specific instructions for other Operating Systems.